﻿#include<bitset>
#include<vector>
#include<iostream>
using namespace std;

template<size_t N>
class twobitset
{
public:
	void set(const size_t& x)
	{
		//00->01
		if (_bits1.test(x) == false && _bits2.test(x) == false)
		{
			_bits2.set(x);
		}
		//01->10
		else if (_bits1.test(x) == false && _bits2.test(x) == true)
		{
			_bits2.reset(x);
			_bits1.set(x);
		}
		//...
		else{}
	}

	void print()
	{
		for (size_t i = 0; i < N; ++i)
		{
			if (_bits1.test(i) == false && _bits2.test(i) == true)
				cout << i << " ";
		}
		cout << endl;
	}

private:
	bitset<N> _bits1;
	bitset<N> _bits2;
};


void test_twobitset()
{
	int a[] = { 3, 45, 53, 32, 32, 43, 3, 2, 5, 2, 32, 55, 5, 53,43,9,8,7,8,7,9,45,55,0 };
	twobitset<100> bs;
	for (auto e : a)
	{
		bs.set(e);
	}

	bs.print();
}
int main()
{
	test_twobitset();
	return 0;
}